
#ifndef WISHMASTER_TASKSENDPOST_H
#define WISHMASTER_TASKSENDPOST_H

#include "misc.h"
#include "task.h"
#include "components/chan.h"

namespace Wishmaster
{
	class TaskSendPostImpl;
    class WISHMASTER_EXPORT TaskSendPost : public Task
	{
		Q_OBJECT
	public:
		TaskSendPost(const PostDescriptor& post, const QString& captcha, Wishmaster2::Network::RequestManager* requestManager, const QString& msg);
		virtual ~TaskSendPost();

		virtual void start();
		virtual void cancel();

		PostDescriptor postDescriptor() const;

		virtual void onError();

	signals:
		void result(TaskSendPost* task, const QByteArray& arr, const QString& contentType);

	protected:
		virtual Wishmaster2::Network::RequestPtr makeRequest(const PostDescriptor& post, const QString& captcha,
				Wishmaster2::Network::RequestManager* connector) = 0;

		virtual void onRequestDone();

	protected slots:
		virtual void requestDone(int id);
		void slot_progress(int done, int total);
	
	private:
		TaskSendPostImpl* m_impl;
	};
}

#endif

